<template>
    <n-loading-bar-provider>
        <n-dialog-provider>
            <n-notification-provider>
                <n-message-provider>
                    <slot></slot>
                    <naive-provider-content></naive-provider-content>
                </n-message-provider>
            </n-notification-provider>
        </n-dialog-provider>
    </n-loading-bar-provider>
</template>

<script setup lang="ts">
import { defineComponent, h } from "vue";
import {
    useLoadingBar,
    useDialog,
    useMessage,
    useNotification,
} from "naive-ui";

function regiseNaiveTools() {
    /** 将naive常用组件挂在至window,便于在路由钩子函数和请求函数内使用 */
    window.$loadingBar = useLoadingBar();
    window.$dialog = useDialog();
    window.$message = useMessage();
    window.$notification = useNotification()
}

const NaiveProviderContent = defineComponent({
    setup() {
        regiseNaiveTools();
    },
    render() {
        return h('div')
    },
})
</script>

<style scoped>
</style>